package com.shg.service.search.impl;

import javax.annotation.Resource;

import org.compass.core.Compass;
import org.compass.core.CompassTemplate;
import org.springframework.stereotype.Service;

import com.shg.bean.Book;
import com.shg.bean.QueryResult;
import com.shg.service.search.BookSearchService;

@Service
public class BookSearchServiceBean implements BookSearchService {

	private CompassTemplate compassTemplate;
	
	@Resource
	public void setCompass(Compass compass){
		this.compassTemplate=new CompassTemplate(compass);
	}
	
	public QueryResult<Book> getSearch(Integer type,String keyWord,int firstResult,int maxResult){
		return compassTemplate.execute(new QueryCallBack(type,keyWord, firstResult, maxResult));
	}
}
